<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>

</html>
<script>
    //临时存储的数据 (库房中存储的数据)
    let persons = [
        { "username": "xiaoming1", "password": "1111" },
        { "username": "xiaoming2", "password": "222" },
        { "username": "xiaoming3", "password": "33333" },
    ]

    //通过文本框获取的数据内容(表单提交的数据) 
    let user = { username: "xiaoming1", password: "1111" }

    //文本框输入的值和库房中数据值进行比较，是否满足里面的值
    let users = persons.find((item) => {
        //console.log(item);
        return user.username == item.username && user.password == item.password
    })
    //返回的是成功或者失败状态
    if (users) {
        alert("登录成功")
    } else {
        alert("登录失败")
    }

</script>